#include #include // Self-referential structure for the task typedef struct task{ int d; struct task* next; }TASK; // Function to specify the task indicate_task(TASK* q) { while(q != 0) { printf("%d", q->d); q = q->next; } } // Removing function the memory that allocated to the task free_list(TASK* p) { TASK* q; while(p != 0); { q=p; p=p->next; free(q); } } // Function to find the address of the task just before of a new // task that will be inserted in the linked-list (identify the address // of the first task) TASK* find(TASK* root, int keyvalue, int* first_task) { TASK* q; TASK* f; f = q = root; while(f->n != 0 && f->d < keyvalue) { q = f; f = f->next; } if(root = f) first_task = 1; else first_task = 0; return q; } // dynamic memory allocation function for task TASK* allocation_task_memory_node() { TASK* p; p = (TASK*)malloc(sizeof(TASK)); if(p==NULL) exit(0); return p; } indicate_task(TASK* q); free_list(TASK* p); TASK* find (TASK* root, int key); TASK* allocation_task_memory_node(); // global variables for storing the start address of the task TASK* g_root; |